# -*- coding:utf-8 -*-
# anaconda python 3.8.5
#%%
from DataTools import datatool, Get_163DailyBar, Get_163FanceReport, Get_163Ticker
import sys
import os
import json


def LinkedPath():
    path = r"D:/StockDatas/"
    sys.path.append(path)

    for i in sys.path:
        print(i)


def Ticker163(dic):
    codeL = dic["code"]
    mode = dic["mode"]
    Get_163Ticker.get_163tickerLoop(codeL, mode="")


def Main():
    LinkedPath()
    with open(r"config_live.json", mode="r") as f:
        res = f.read()
    codeL = json.loads(res)["updating_code_list"]
    with open(r"config_path.json", mode="r") as f:
        res = f.read()
    ParthDic = json.loads(res)

    Get_163Ticker.get_163tickerLoop(codeL, mode="", ParthDic=ParthDic)
    for _ in range(2):
        Get_163DailyBar.Mainloop_async(ParthDic=ParthDic)
    Get_163FanceReport.FianceReportMain(
        mode=2, MainPath=r"D:/StockDatas/", subPath=r"Reports/", retrytime=5
    )


#%%
if __name__ == "__main__":
    Main()